<?php
//namespace student\controller\welcome;
defined('BASEPATH') OR exit('No direct script access allowed');

class Certify extends CI_Controller {


	public function __construct()
	{
		parent::__construct();
		$this->load->helper('url_helper');
		$this->load->model("getuser");
        session_start();
	}

    

    /**
     * 个人认证主函数
     */
    public function personal()
    {
        $step = @$_REQUEST['step']?@$_REQUEST['step']:1;
        $desc = "无";
        if($step == 3){
            $email = $_REQUEST['email'];
            $linkman = $_REQUEST['linkman'];
            $vocation = $_REQUEST['vocation'];
            $res = $this->getuser->modifyUserInfo($linkman,$email,$vocation);
            if($res){
                $desc = "您的信息已成功提交。我们会在24小时内审核完成，请耐心等待审核！";        
            } else {
                $desc = "认证失败，请重新提交认证信息";
            }
        }
        $data = array('step'=>$step,'desc'=>$desc);
        $this->load->view("home/userinfo/top_userinfo");
        $this->load->view("home/userinfo/certify/personal",$data);
        $this->load->view("home/bottom_detaildata");
    }


    /**
    * 企业认证主函数
    **/
    public function company()
    {
        $step = @$_REQUEST['step']?$_REQUEST['step']:1;

        if($step == 3){
            $data['tel'] = $_REQUEST['tel'];
            $data['email'] = $_REQUEST['email'];
            $data['company_name'] = $_REQUEST['company_name'];
            $data['boss_name'] = $_REQUEST['boss_name'];
            $data['business_scope'] = $_REQUEST['business_scope'];
            $data['company_id'] = $_REQUEST['company_id'];
            $data['vocation'] = $_REQUEST['vocation'];
            $data['business_name'] = $_REQUEST['business_name'];

            $res = $this->getuser->modifyCompany($data);
        }
        
        $data = array("step"=>$step);
        $this->load->view("home/userinfo/top_userinfo");
        $this->load->view("home/userinfo/certify/company",$data);
        $this->load->view("home/bottom_detaildata");
    }
}
